package org.feng.utils;

import org.feng.base.entity.Result;
import org.feng.exception.TransferServiceException;
import org.feng.base.enums.ErrorCode;

/**
 * @Author feng
 * @Date 2022/3/10 14:47
 * @Description TODO
 */
public class ResponseUtil {

    public static <T> T checkResponse(Result<T> result) {
        if (result.getFlag()) {
            return result.getData();
        } else {
            throw new TransferServiceException(ErrorCode.TRANSFER_SERVICE);
        }
    }

}
